package com.santiao.youxiang.ui.adapter

import android.util.Log
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.santiao.youxiang.bean.habitTimeLineBean
import com.santiao.youxiang.R
//import com.caipudaquan.entity.FoodSearchResbean


class TimeDetailAdapter(data: MutableList<habitTimeLineBean.Detail>? = null) :
    BaseQuickAdapter<habitTimeLineBean.Detail, BaseViewHolder>(R.layout.item_time_linel_detail, data) {

    init {
        // 注册需要监听点击的子视图 ID
//        addChildClickViewIds(R.id.ck_check)
    }

    override fun convert(holder: BaseViewHolder, item: habitTimeLineBean.Detail) {
        // 绑定数据到视图

        Log.e("convert:名称 ", item.habitName.toString())

        when (item.habitType){
            "1"->{
                holder.setImageResource(R.id.iv_photo,R.drawable.ic_habit_bg5)
            }

            "2"->{
                holder.setImageResource(R.id.iv_photo,R.drawable.ic_habit_bg6)
            }

            "3"->{
                holder.setImageResource(R.id.iv_photo,R.drawable.ic_habit_bg7)
            }

            "4"->{
                holder.setImageResource(R.id.iv_photo,R.drawable.ic_habit_bg8)
            }
            else -> {
                holder.setImageResource(R.id.iv_photo,R.drawable.ic_habit_bg9)
            }

        }

        holder.setText(R.id.tv_habit_name, item.habitName)

        holder.setText(R.id.tv_habit_time, item.dateTime)

        holder.setText(R.id.tv_des, item.describe)

        // 获取 CheckBox 并绑定选中状态

    }



}